#ifndef SYSTRAYICON_H
#define SYSTRAYICON_H

#include <QList>
#include <QDockWidget>
#include <QListWidget>
#include <QPushButton>
#include <QListWidgetItem>
#include <QSystemTrayIcon>
#include "lib/bbs.h"
#include "lib/options.h"

/*
 * 目标：
 * 1、实现弹出提示。
 * 2、模仿QQ的提示框，将提示的信息列表，点击某项即刻发出signal（MainWindow此时处理信号，弹出并转至对应的项目)
 * 3、简要的右键菜单：打开，配置，关于，退出。以及针对多账户的各自的操作菜单（登录，退出）
 */
class SystrayIcon: public QSystemTrayIcon{
    Q_OBJECT
    private:
	//列表缓冲池
	QList<Board *> boards;
	QList<Topic *> topics;
	QList<Article *> articles;
	QStringList messages;
	//单例模式引用
	static SystrayIcon * GlobalSystray;
	//小Dock Widget
	QDockWidget * dock;
	QListWidget * list;
	QPushButton * button;
    private slots:
	void on_list_clicked(QListWidgetItem * item);
	void on_button_clicked();
	void on_dock_visibilityChanged(bool visible);
	void on_activated ( QSystemTrayIcon::ActivationReason reason );
	void on_messageClicked();
    public slots:
	void addItem(Board * board);
	void addItem(Topic * topic);
	void addItem(Article * article);
	void addItem(QString message);
    signals:
	//处理托盘的点击事件，并同时传递出去
	void clicked ( QSystemTrayIcon::ActivationReason reason );
	void boardClicked(Board * board);
	void topicClicked(Topic * topic);
	void articleClicked(Article * article);
	void messageClicked(QString message);
    private:
	SystrayIcon(QObject * parent = 0);		//单例模式
	void alarm(bool value = true);
    public:
	static SystrayIcon * getSystrayIcon();
};

#endif